package com.service.single.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.Table;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import java.time.LocalDateTime;

/**
 * @Author: 一休
 * @DateTime: 2022/11/2 11:07
 */
@Table(appliesTo = "file_info", comment = "文件信息")
@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
public class FileInfo {

    @Id
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    private Long id;

    /**
     * 文件名称
     */
    @Column(columnDefinition = "varchar(255) NOT NULL COMMENT '文件名称'")
    @TableField(value = "file_name")
    private String fileName;

    /**
     * 文件路径
     */
    @Column(columnDefinition = "varchar(255) NOT NULL COMMENT '文件路径'")
    @TableField(value = "file_path")
    private String filePath;

    /**
     * 文件类型
     */
    @Column(columnDefinition = "int(11) NOT NULL COMMENT '文件类型 0 excel, 1 doc, 2 docx ,3 pdf '")
    @TableField(value = "file_type")
    private Integer fileType;

    /**
     * 操作人
     */
    @Column(columnDefinition = "varchar(255) NOT NULL COMMENT '操作人'")
    @TableField(value = "operator")
    private String operator;

    /**
     * 用户创建时间
     */
    @Column(columnDefinition = "datetime DEFAULT null COMMENT '创建时间'")
    @TableField(value = "created_time", fill = FieldFill.INSERT)
    private LocalDateTime createdTime;

    /**
     * 修改时间
     */
    @Column(columnDefinition = "datetime DEFAULT null COMMENT '修改时间'")
    @TableField(value = "update_time", fill = FieldFill.UPDATE)
    private LocalDateTime updateTime;
}
